# Maintainer: AndyRTR <andyrtr@archlinux.org>
# Conributor: Mélanie Chauvel (ariasuni) <perso at hack-libre dot org>

pkgname=nuspell
pkgver=5.1.3
pkgrel=1
pkgdesc='Fast and safe spellchecking C++ library'
arch=('loong64' 'x86_64')
url='https://nuspell.github.io/'
license=('LGPL3')
depends=('icu' 'glibc' 'gcc-libs')
makedepends=('cmake')
checkdepends=('catch2')
source=(${pkgname}-${pkgver}.tar.gz::"https://github.com/nuspell/nuspell/archive/v${pkgver}.tar.gz")
sha512sums=('72c868f734848be79c7cfb0502298626307213e4f3f422f8e9ee7dac24cb3d79ea55d04ef0443e7107bb11eb545c79a15a8aea8cb056dc2805c23bd5e3292562')

# 1st rebuild enchant
# 2nd rebuild epiphany against nuspell/enchant that checkdepens on both

prepare() {
  mkdir build
}

build() {
  cd build
  cmake ../${pkgbase}-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DBUILD_SHARED_LIBS=ON
  make
}

check() {
  cd build
  make test
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
}
